<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="商品品牌信息管理">
    <#if (goodsCategoryId)??>
        <#assign isEdit = true />
    <#else>
        <#assign isAdd = true />
    </#if>



<body class="input">

<script type="text/javascript">
    $().ready(function () {

        var $validateErrorContainer = $("#validateErrorContainer");
        var $validateErrorLabelContainer = $("#validateErrorContainer ul");
        var $validateForm = $("#inputForm");
        var $tab = $("#tab");

        // Tab效果
        $tab.tabs(".tabContent", {
            tabs:"input"
        });

        // 表单验证
        $validateForm.validate({
            errorContainer:$validateErrorContainer,
            errorLabelContainer:$validateErrorLabelContainer,
            wrapper:"li",
            errorClass:"validateError",
            ignoreTitle:true,
            rules:{
                "goodsBrand.gameName":{
                    required:true
                },
                "goodsBrand.initDisplay":{
                    required:true
                },
                "goodsBrand.enable":{
                    required:true
                },
                "goodsBrand.remark":{
                    maxlength:500
                }
            },
            messages:{
                "goodsBrand.gameName":{
                    required:"请填写商品品牌名称！"
                },
                "goodsBrand.initDisplay":{
                    required:"初始化显示为必填项，请选择一项！"
                },
                "goodsBrand.enable":{
                    required:"是否启用为必填项，请选择一项！"
                },
                "goodsBrand.remark":{
                    maxlength:"备注内容必须要小于等于500"
                }
            },
            submitHandler:function (form) {
                $(form).find(":submit").attr("disabled", true);
                form.submit();
            }
        });
        <#if actionErrors?? && (actionErrors?size > 0)>
            $.messager.show("提示信息", "<#list errorMessages as list>${list}<br></#list>", 2000);
        </#if>
    });
</script>

<div class="body">
    <div class="inputBar">
        <h1><span class="icon">&nbsp;</span><#if isAdd??>添加商品品牌<#else>编辑商品品牌</#if></h1>
    </div>
    <div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
        <div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
        <ul></ul>
    </div>
    <form id="inputForm" class="validate"
          action="<#if isAdd??>${web_base}/game/goods_brand!save.htm<#else>${web_base}/game/goods_brand!edit.htm</#if>"
          method="post">
        <input type="hidden" name="brandId" value="${brandId!}">
        <input type="hidden" name="brandName" value="${brandName!}">
        <ul class="tab">
            <li>
                <input type="button" value="基本信息" hidefocus="true"/>
            </li>
        </ul>
        <input type="hidden" name="goodsBrand.id" class="formText" value="<#if goodsBrand??>${(goodsBrand.id)!}</#if>"/>
        <table class="inputTable tabContent">
            <#if !isAdd??>
                <tr>
                    <th>
                        商品品牌编号:
                    </th>
                    <td>
                        <#if goodsBrand??>
                        ${(goodsBrand.goodsCategoryId)!}
                            <input type="hidden" name="goodsBrand.goodsCategoryId" class="formText {required: true}"
                                   value="${(goodsBrand.goodsCategoryId)!}"/>
                        </#if>
                    </td>
                </tr>

            </#if>
            <tr>
                <th>
                    商品品牌名称:
                </th>
                <td>
                    <#if isAdd??>
                        <input type="text" name="goodsBrand.gameName" class="formText {required: true}" value=""/>
                        <label class="requireField">*</label>
                    <#else>
                        <#if goodsBrand??>
                            <input type="text" name="goodsBrand.gameName" class="formText {required: true}"
                                   value="${(goodsBrand.gameName)!}"/>
                        </#if>
                    </#if>

                </td>
            </tr>
            <tr>
                <th>
                    热度选择：
                </th>
                <td>
                    <#if !isAdd??>
                        <select name="goodsBrand.heat" class="formText">
                            <option value=1>请选择...</option>
                            <option value=2
                                    <#if goodsBrand?? && goodsBrand.heat?? && goodsBrand.heat==2>selected="selected"</#if>>
                                热门
                            </option>
                            <option value=1
                                    <#if goodsBrand?? && goodsBrand.heat?? && goodsBrand.heat==1>selected="selected"</#if>>
                                一般
                            </option>
                        </select>
                    <#else>
                        <select name="goodsBrand.heat" class="formText">
                            <option value=1 selected="selected">请选择...</option>
                            <option value=2>
                                热门
                            </option>
                            <option value=1>
                                一般
                            </option>
                        </select>
                    </#if>
                    <label class="requireField">*</label>
                </td>
            </tr>
            <tr>
                <th>
                    初始化显示：
                </th>
                <td>
                    <#if !isAdd??>
                        <select name="goodsBrand.initDisplay" class="formText {required: true}">
                            <option value="">请选择...</option>
                            <option value="0"
                                    <#if goodsBrand?? && goodsBrand.initDisplay=="0">selected="selected"</#if>>
                                不显示
                            </option>
                            <option value="1"
                                    <#if goodsBrand?? && goodsBrand.initDisplay=="1">selected="selected"</#if>>
                                显示
                            </option>
                        </select>
                    <#else>
                        <select name="goodsBrand.initDisplay" class="formText {required: true}">
                            <option value="" selected="selected">请选择...</option>
                            <option value="0">
                                不显示
                            </option>
                            <option value="1">
                                显示
                            </option>
                        </select>
                    </#if>
                    <label class="requireField">*</label>
                </td>
            </tr>
            <tr>
                <th>
                    是否启用：
                </th>
                <td>
                    <#if !isAdd??>
                        <select name="goodsBrand.enable" class="formText {required: true}">
                            <option value="">请选择...</option>
                            <option value="1" <#if goodsBrand?? && goodsBrand.enable=="1">selected="selected"</#if>>
                                启用
                            </option>
                            <option value="0" <#if goodsBrand?? && goodsBrand.enable=="0">selected="selected"</#if>>
                                禁用
                            </option>
                        </select>
                    <#else>
                        <select name="goodsBrand.enable" class="formText {required: true}">
                            <option value="" selected="selected">请选择...</option>
                            <option value="0">
                                启用
                            </option>
                            <option value="1">
                                禁用
                            </option>
                        </select>
                    </#if>
                    <label class="requireField">*</label>
                </td>
            </tr>
            <tr>
                <th>
                    备注：
                </th>
                <td>
                    <textarea name="goodsBrand.remark" class="formTextarea"><#if goodsBrand??>${(goodsBrand.remark)!}</#if></textarea>
                </td>
            </tr>
        </table>
        <div class="buttonArea">
            <input type="submit" class="formButton" <#if isAdd??> value="添  加" <#else>
                   value="更  新"</#if>hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回"
                   hidefocus="true"/>
        </div>
    </form>
</div>
</body>
</@edit>
